package pack01_udf;

import org.apache.hadoop.hive.ql.exec.UDF;

/**
 * @author lilulu
 * @date 2023/2/15 19:20
 */
@SuppressWarnings("all")
public class MyUDF extends UDF {

    public String evaluate(String numPhone) {
        String regex = "[1][3-9][0-9]{9}";
        if (!numPhone.matches(regex)) {
            return numPhone;
        }
        String s1 = numPhone.substring(0, 3);
        String s2 = numPhone.substring(7);
        return s1 + "****" + s2;
    }

}
